/**
 * Created by admin on 2017/5/17.
 */
//自定义校验规则
    //手机号
$.validator.addMethod("isMobile", function (value, element) {
    var length = value.length;
    var mobile = /^[1][34578][\d]{9}$/;
    return this.optional(element) || (length == 11 && mobile.test(value));
}, "请填写正确的手机号格式");

//邮箱
$.validator.addMethod("isEmail", function (value, element) {
    var length = value.length;
    var email = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
    return this.optional(element) || (email.test(value));
}, "请填写正确的邮箱格式");

//用户名
$.validator.addMethod("username", function (value, element) {
//            var length = value.length;
    var name = /^[a-zA-Z0-9]{5,16}$/;
    return this.optional(element) || (name.test(value));
}, "用户名只能含有字母或数字");

//真实姓名
$.validator.addMethod("realname", function (value, element) {
//            var length = value.length;
    var realname = /^([\u4e00-\u9fa5]){2,7}$/;
    return this.optional(element) || (realname.test(value));
}, "请输入正确的真实姓名");

//密码
$.validator.addMethod("password", function (value, element) {
//            var length = value.length;
    var pass = /^\S{6,18}$/;
    return this.optional(element) || (pass.test(value));
}, "请输入6-18位不含空格密码");

//验证100的整数倍
$.validator.addMethod("hundred", function (value, element) {
    var num = /^[1-9]\d*00$/;
    return this.optional(element) || (num.test(value));
}, "请输入100的整数倍");